#import "CTBasicTableFooter.h"
@interface CTBasicTableFooter ()
@property (nonatomic ,strong) UILabel *tipLabel;
@property (nonatomic ,strong) UIButton *telButton;
@property (nonatomic ,strong) UILabel *subTipLabel;
@end
@implementation CTBasicTableFooter
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setUI];
    }
    return self;
}
- (void)setUI {
    [self addSubview:self.tipLabel];
    [self addSubview:self.telButton];
    [self addSubview:self.subTipLabel];
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(Ratio(12));
        make.left.mas_equalTo(Ratio(26));
    }];
    [self.telButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(self.tipLabel);
        make.left.mas_equalTo(self.tipLabel.mas_right).offset(Ratio(6));
    }];
    [self.subTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.tipLabel.mas_bottom).offset(Ratio(10));
        make.left.mas_equalTo(self.tipLabel);
        make.right.mas_equalTo(Ratio(-26));
    }];
}
- (UILabel *)tipLabel {
    if (!_tipLabel) {
        _tipLabel = [[UILabel alloc] init];
        _tipLabel.numberOfLines = 1;
        _tipLabel.font = [UIFont systemFontOfSize:Ratio(12)];
        _tipLabel.textColor = [UIColor blackColor];
        _tipLabel.textAlignment = NSTextAlignmentLeft;
        _tipLabel.text = @"You don't know your BVN? dial";
    }
    return _tipLabel;
}
- (UIButton *)telButton
{
    if (!_telButton) {
        _telButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _telButton.backgroundColor = [UIColor colorFF6C2E];
        _telButton.titleLabel.font = [UIFont systemFontOfSize:12.f];
        [_telButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_telButton setTitle:@" *565*0# " forState:UIControlStateNormal];
        [_telButton addTarget:self action:@selector(telButtonClick) forControlEvents:UIControlEventTouchUpInside];
        _telButton.layer.masksToBounds = YES;
        _telButton.layer.cornerRadius = 10;
    }
    return _telButton;
}
- (void)telButtonClick {
    NSMutableString * aStr=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"*565*0#"];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:aStr] options:@{} completionHandler:^(BOOL success) { }];
}
- (UILabel *)subTipLabel {
    if (!_subTipLabel) {
        _subTipLabel = [[UILabel alloc] init];
        _subTipLabel.numberOfLines = 1;
        _subTipLabel.font = [UIFont systemFontOfSize:Ratio(12)];
        _subTipLabel.textColor = [UIColor blackColor];
        _subTipLabel.textAlignment = NSTextAlignmentLeft;
        _subTipLabel.text = @"Please fill in your correct BVN, ensure that the BVN belongs to the name provided above otherwise your loan may not be approved.";
    }
    return _subTipLabel;
}
@end
